package cn.hcbycloud.auth.client;


import cn.hcbycloud.auth.dto.LoginInfoDTO;
import cn.hcbycloud.auth.hystrix.ExternalPermissionCheckClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author gaoh
 * @desc 认证中心对外鉴权接口
 * @date 2022年02月08日 下午 3:38
 */
@FeignClient(
        contextId = "ExternalPermissionCheckClient",
        value = "hcbycloud-platform-service-auth-starter",
        fallbackFactory = ExternalPermissionCheckClientFallback.class)
public interface ExternalPermissionCheckClient {
    /**
     * 根据认证信息获取权限列表
     *
     * @param loginInfoDTO
     * @return
     */
    @PostMapping(value = "/external/permissions")
    List<String> getPermissionsByFeign(@RequestBody LoginInfoDTO loginInfoDTO);

    /**
     * 根据认证信息获取角色列表
     *
     * @param loginInfoDTO
     * @return
     */
    @PostMapping(value = "/external/roles")
    List<String> getRolesByFeign(@RequestBody LoginInfoDTO loginInfoDTO);
}